package com.ydgk.jishuzhan.service.impl;

import com.ydgk.jishuzhan.beans.User;
import com.ydgk.jishuzhan.beans.UserInfo;
import com.ydgk.jishuzhan.dao.UserInfoMapper;
import com.ydgk.jishuzhan.dao.UserMapper;
import com.ydgk.jishuzhan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UserInfoMapper userInfoMapper;

    public User login(User user) {
        return userMapper.validUser(user);
    }

    public int register(User user) {
        return userMapper.save(user);
    }

    @Override
    public void updateUser(User user) {
        userMapper.update(user);
    }

    @Override
    public void updatePassword(User user) {
        userMapper.updatePassword(user);
    }

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public User findUserById(Integer id) {
        return userMapper.findUserById(id);
    }

    @Override
    public int findFriend(Integer userId, Integer friendId) {
        return userMapper.findFriend(userId,friendId);
    }

    @Override
    public void guanzhu(Integer userId, Integer friendId) {
        userMapper.guanzhu(userId,friendId);
    }

    @Override
    public List<Integer> findFriends(Map<String, Object> map) {
        return userMapper.findFriends(map);
    }

    @Override
    public Integer queryFriendTotal(Map<String, Object> map) {
        return userMapper.queryFriendTotal(map);
    }

}
